//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    showFlag:true,
    warnFlag:true,
    name:'',
    chinese_score:'',
    math_score:'',
    avg:''
  },
  nameIn:function(e){
    this.setData({
      name:e.detail.value,
      warnFlag:true,
      showFlag:true
    })
  },
  chineseIn:function(e){
    this.setData({
      chinese_score:e.detail.value,
      warnFlag:true,
      showFlag:true
    })
  },
  mathIn:function(e){
    this.setData({
      math_score:e.detail.value,
      warnFlag:true,
      showFlag:true
    })
  },
  mySubmit:function(){
    if(this.data.name==''||this.data.chinese_score==''||this.data.math_score==''){
      this.setData({
        warnFlag:false,
      })
      return;
    }else{
      var a=(this.data.chinese_score*1.0+this.data.math_score*1.0)/2.0
      this.setData({
        showFlag:false,
        avg:a
      })
    }
  }
})
